<template>
	<view class="community">
		<!-- <com-nav v-model="type" :list="['我的邀请', '我的收益']"></com-nav> -->

		<view v-if="type == 0" class="text-center text-white bg-white">
			<!-- <view class="flex padding ">
				<view class="flex align-center radius padding"
					style="background-image: linear-gradient(to right,#4e77f6,#4662db);width: 50%;">
					<image src="/static/my/order1.png" style="width: 74rpx;height: 74rpx;"></image>
					<view class="margin-left">
						<view class="text-xs">
							社区总人数
						</view>
						<view class="text-lg margin-top8">
							{{topInfo.manCount || 0}}
						</view>
					</view>

				</view>
				<view class="flex align-center radius margin-left-sm padding"
					style="background-image: linear-gradient(to right,#22beb3,#29abc0);width: 50%;"
					@click="goto('/pages/my/applyTrader/index')">
					<image src="/static/my/order2.png" style="width: 80rpx;height: 74rpx;"></image>
					<view class="margin-left">
						<view class="text-xs">
							个人总收益
						</view>
						<view class="text-lg margin-top8">
							￥{{topInfo.lsTotal || 0}}
						</view>
					</view>

				</view>

			</view> -->

			<view class="flex flex-wrap padding-sm margin-top bg-white">
				<view style="width: 50%;">账号</view>
				<view style="width: 50%;">级别</view>
				<!-- <view style="width: 40%;">注册时间</view> -->
			</view>
			<view class="flex flex-wrap padding-sm bg-white" v-for="v in branchList">
				<view style="width: 50%;">{{v.nickName}}</view>
				<view style="width: 50%;">直属下级</view>
				<!-- <view style="width: 40%;">{{v.createTime || ""}}</view> -->
			</view>
			<!-- <view class="grid col-4 padding margin-top bg-white">
				<view class="basis-df">账号</view>
				<view class="basis-df">级别</view>
				<view class=" text-right">注册时间</view>
			</view>
			<view class="grid col-4 padding text-grey" v-for="v in branchList">
				<view class="text-left">{{utils.hidePhone(v.userName)}}</view>
				<view>直属下级</view>
				<view class="text-right">{{v.createTime}}</view>
			</view>

			<view class="flex justify-between padding margin-top bg-white">
				<view >账号</view>
				<view>级别</view>
				<view>注册时间</view>
			</view>
			<view class="flex justify-between padding text-grey" v-for="v in branchList">
				<view >{{utils.hidePhone(v.userName)}}</view>
				<view>直属下级</view>
				<view>{{v.createTime}}</view>
			</view> -->
		</view>
		<view v-if="type == 1" class="bg-white">
			<view class="cu-list menu-avatar">
				<view class="cu-item" v-for="v in myList">
					<view class="cu-avatar lg bg-white cuIcon-moneybagfill text-red text-xsl" >
					</view>
					<view class="content">
						<view>{{v.type | lsFlt}}</view>
						<view class="text-grey text-sm">{{v.createTime}}</view>
						<!-- <view>绑定微信></view> -->
					</view>
					<view class="text-orange text-bold padding-lr">
						{{v.money}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import comNav from "../../../components/comNav.vue"
	import communityApi from "../../../api/communityApi.js"
	import userApi from "../../../api/userApi.js"
	import utils from "../../../utils/utils.js"
	import loginApi from "@/api/new/login.js"
	export default {
		components:{comNav},
		data() {
			return {
				utils,
				type: 0,
				topInfo: {},
				userList: [],
				branchList: [],
				myList: []
			}
		},
		onLoad(option) {
			console.log("option", option)
			this.init()
		},
		onPullDownRefresh() {
			this.init()
		},
		methods: {
			init() {
				// // 获取统计数据
				// communityApi.getCount().then(res => {
				// 	this.topInfo = res
				// })
				// // 获取我的收益
				// userApi.balanceList().then(res => {
				// 	this.myList = res.rows.filter(item => item.money > 0)
				// })
				// 获取直属下级
				// communityApi.getBranchList().then(res => {
				// 	this.branchList = res.rows
				// })
				loginApi.getSubUserlist({
					pageNum: 1,
					pageSize: 10000
				}).then(res => {
					this.branchList = res.rows
				})
			},
		}
	}
</script>

<style lang="scss">
	.community{
		.cu-item{
			margin: 0 50rpx;
		}
		.box{
			border: 1px solid #666666;
			padding: 20rpx;
			width: 300rpx;
		}
	}
</style>
